package com.sam.im.heiqun.uis;

import android.content.Context;
import android.media.MediaScannerConnection;
import android.net.Uri;

/**
 * Created by zhangqiang on 2018/7/17.
 */
public class MediaUtil {

    private static MediaScannerConnection connection = null;

    public static void refreshMediaFileStore(Context context, final String path, final String mimeType) {

        connection = new MediaScannerConnection(context, new MediaScannerConnection.MediaScannerConnectionClient() {
            @Override
            public void onMediaScannerConnected() {
                connection.scanFile(path,mimeType);
            }

            @Override
            public void onScanCompleted(String path, Uri uri) {
                connection.disconnect();
                connection = null;
            }
        });
        connection.connect();
    }

}
